package com.dahuyou.monitor.method;

import java.lang.instrument.Instrumentation;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class MyPreMain {

    public static void premain(String agentArgs, Instrumentation instrumentation) {
        System.out.println("this is my agent：" + agentArgs);
        Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> {
            MyJvmStack.printMemoryInfo();
            MyJvmStack.printGCInfo();
            System.out.println("====================================================== =============================================");
        }, 0, 5000, TimeUnit.MILLISECONDS);
    }
}
